<template>
        <el-menu unique-opened router background-color="#333744" text-color="#fff" active-text-color="#ffd04b">
            <el-submenu :index="item.path" v-for="item in leftMenuData" :key="item.id">
                <template slot="title">
                    <span>{{item.authName}}</span>
                </template>
                <el-menu-item :index="it.path" v-for="it in item.children" :key="it.id">
                    <template slot="title">
                        <i class="el-icon-s-unfold"></i>
                        <span>{{it.authName}}</span>
                    </template>
                </el-menu-item>
            </el-submenu>
        </el-menu>
</template>

<script type="text/ecmascript-6">
    import {requestAsideData} from '@/network/home.js'
    export default {
        
        data() {
            return {
                leftMenuData:[]
            }
        },
        created(){
            this.getAsideData()
        },
        methods: {
            //获取侧边栏数据的函数
            async getAsideData(){
                const {data} = await requestAsideData()
                this.leftMenuData = data.data;
                // console.log(this.leftMenuData);
            }
        },
    }
</script>

<style lang='less' scoped>
    .el-menu{
        overflow: hidden;
        height: 100%;
    }
</style>
